<?php
/**
 *
 * Sets up the theme and provides some helper functions. Some helper functions
 * are used in the theme as custom template tags. Others are attached to action and
 * filter hooks in WordPress to change core functionality.
 *
 * The first function, twentyten_setup(), sets up the theme by registering support
 * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
 *
 * When using a child theme (see http://codex.wordpress.org/Theme_Development and
 * http://codex.wordpress.org/Child_Themes), you can override certain functions
 * (those wrapped in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before the parent
 * theme's file, so the child theme functions would be used.
 *
 * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
 * to a filter or action hook. The hook can be removed by using remove_action() or
 * remove_filter() and you can attach your own function to the hook.
 *
 * We can remove the parent theme's hook only after it is attached, which means we need to
 * wait until setting up the child theme:
 *
 * <code>
 * add_action( 'after_setup_theme', 'my_child_theme_setup' );
 * function my_child_theme_setup() {
 *     // We are providing our own filter for excerpt_length (or using the unfiltered value)
 *     remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
 *     ...
 * }
 * </code>
 *
 * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
 *
 */

/**
 * Set the content width based on the theme's design and stylesheet.
 *
 * Used to set the width of images and content. Should be equal to the width the theme
 * is designed for, generally via the style.css stylesheet.
 */
if ( ! isset( $content_width ) )
	$content_width = 640;

/** Tell WordPress to run twentyten_setup() when the 'after_setup_theme' hook is run. */
add_action( 'after_setup_theme', 'twentyten_setup' );

if ( ! function_exists( 'twentyten_setup' ) ):
function twentyten_setup() {

	// This theme styles the visual editor with editor-style.css to match the theme style.
	add_editor_style();

	// This theme uses post thumbnails
	add_theme_support( 'post-thumbnails' );

	// Add default posts and comments RSS feed links to head
	add_theme_support( 'automatic-feed-links' );

	// Make theme available for translation
	// Translations can be filed in the /languages/ directory
	load_theme_textdomain( 'theme1095', TEMPLATEPATH . '/languages' );

	$locale = get_locale();
	$locale_file = TEMPLATEPATH . "/languages/$locale.php";
	if ( is_readable( $locale_file ) )
		require_once( $locale_file );

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus( array(
		'primary' => __( 'Primary Navigation', 'theme1095' ),
	) );

	// This theme allows users to set a custom background
	add_custom_background();
	
	// This theme allows users to set a custom logo
	add_custom_logo();

	// Your changeable header business starts here
	define( 'HEADER_TEXTCOLOR', '' );
	// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
	define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' );

	// The height and width of your custom header. You can hook into the theme's own filters to change these values.
	// Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );

	// We'll be using post thumbnails for custom header images on posts and pages.
	// We want them to be 940 pixels wide by 198 pixels tall.
	// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
	set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

	// Don't support text inside the header image.
	define( 'NO_HEADER_TEXT', true );

	// Add a way for the custom header to be styled in the admin panel that controls
	// custom headers. See twentyten_admin_header_style(), below.
	add_custom_image_header( '', 'twentyten_admin_header_style' );

	// ... and thus ends the changeable header business.

	// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
	register_default_headers( array(
		'berries' => array(
			'url' => '%s/images/headers/berries.jpg',
			'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Berries', 'theme1095' )
		),
		'cherryblossom' => array(
			'url' => '%s/images/headers/cherryblossoms.jpg',
			'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Cherry Blossoms', 'theme1095' )
		),
		'concave' => array(
			'url' => '%s/images/headers/concave.jpg',
			'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Concave', 'theme1095' )
		),
		'fern' => array(
			'url' => '%s/images/headers/fern.jpg',
			'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Fern', 'theme1095' )
		),
		'forestfloor' => array(
			'url' => '%s/images/headers/forestfloor.jpg',
			'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Forest Floor', 'theme1095' )
		),
		'inkwell' => array(
			'url' => '%s/images/headers/inkwell.jpg',
			'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Inkwell', 'theme1095' )
		),
		'path' => array(
			'url' => '%s/images/headers/path.jpg',
			'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Path', 'theme1095' )
		),
		'sunset' => array(
			'url' => '%s/images/headers/sunset.jpg',
			'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Sunset', 'theme1095' )
		)
	) );
}
endif;

if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
/**
 * Styles the header image displayed on the Appearance > Header admin panel.
 *
 * Referenced via add_custom_image_header() in twentyten_setup().
 *
 * @since Twenty Ten 1.0
 */
function twentyten_admin_header_style() {
?>
<style type="text/css">
/* Shows the same border as on front end */
#headimg {
	border-bottom: 1px solid #000;
	border-top: 4px solid #000;
}
/* If NO_HEADER_TEXT is false, you would style the text with these selectors:
	#headimg #name { }
	#headimg #desc { }
*/
</style>
<?php
}
endif;

/**
 * Makes some changes to the <title> tag, by filtering the output of wp_title().
 *
 * If we have a site description and we're viewing the home page or a blog posts
 * page (when using a static front page), then we will add the site description.
 *
 * If we're viewing a search result, then we're going to recreate the title entirely.
 * We're going to add page numbers to all titles as well, to the middle of a search
 * result title and the end of all other titles.
 *
 * The site title also gets added to all titles.
 *
 * @since Twenty Ten 1.0
 *
 * @param string $title Title generated by wp_title()
 * @param string $separator The separator passed to wp_title(). Twenty Ten uses a
 * 	vertical bar, "|", as a separator in header.php.
 * @return string The new title, ready for the <title> tag.
 */
function twentyten_filter_wp_title( $title, $separator ) {
	// Don't affect wp_title() calls in feeds.
	if ( is_feed() )
		return $title;

	// The $paged global variable contains the page number of a listing of posts.
	// The $page global variable contains the page number of a single post that is paged.
	// We'll display whichever one applies, if we're not looking at the first page.
	global $paged, $page;

	if ( is_search() ) {
		// If we're a search, let's start over:
		$title = sprintf( __( 'Search results for %s', 'theme1095' ), '"' . get_search_query() . '"' );
		// Add a page number if we're on page 2 or more:
		if ( $paged >= 2 )
			$title .= " $separator " . sprintf( __( 'Page %s', 'theme1095' ), $paged );
		// Add the site name to the end:
		$title .= " $separator " . get_bloginfo( 'name', 'display' );
		// We're done. Let's send the new title back to wp_title():
		return $title;
	}

	// Otherwise, let's start by adding the site name to the end:
	$title .= get_bloginfo( 'name', 'display' );

	// If we have a site description and we're on the home/front page, add the description:
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) )
		$title .= " $separator " . $site_description;

	// Add a page number if necessary:
	if ( $paged >= 2 || $page >= 2 )
		$title .= " $separator " . sprintf( __( 'Page %s', 'theme1095' ), max( $paged, $page ) );

	// Return the new title to wp_title():
	return $title;
}
add_filter( 'wp_title', 'twentyten_filter_wp_title', 10, 2 );

/**
 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
 *
 * To override this in a child theme, remove the filter and optionally add
 * your own function tied to the wp_page_menu_args filter hook.
 *
 * @since Twenty Ten 1.0
 */
function twentyten_page_menu_args( $args ) {
	$args['show_home'] = true;
	return $args;
}
add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );

/**
 * Sets the post excerpt length to 40 characters.
 *
 * To override this length in a child theme, remove the filter and add your own
 * function tied to the excerpt_length filter hook.
 *
 * @since Twenty Ten 1.0
 * @return int
 */
function twentyten_excerpt_length( $length ) {
	return 40;
}
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );

/**
 * Returns a "Continue Reading" link for excerpts
 *
 * @since Twenty Ten 1.0
 * @return string "Continue Reading" link
 */
function twentyten_continue_reading_link() {
	return ' <a href="'. get_permalink() . '">' . __( 'read more', 'theme1095' ) . '</a>';
}

/**
 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
 *
 * To override this in a child theme, remove the filter and add your own
 * function tied to the excerpt_more filter hook.
 *
 * @since Twenty Ten 1.0
 * @return string An ellipsis
 */
function twentyten_auto_excerpt_more( $more ) {
	return ' &hellip;' . twentyten_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

/**
 * Adds a pretty "Continue Reading" link to custom post excerpts.
 *
 * To override this link in a child theme, remove the filter and add your own
 * function tied to the get_the_excerpt filter hook.
 *
 * @since Twenty Ten 1.0
 * @return string Excerpt with a pretty "Continue Reading" link
 */
function twentyten_custom_excerpt_more( $output ) {
	if ( has_excerpt() && ! is_attachment() ) {
		$output .= twentyten_continue_reading_link();
	}
	return $output;
}
add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );

/**
 * Remove inline styles printed when the gallery shortcode is used.
 *
 * Galleries are styled by the theme in Twenty Ten's style.css.
 *
 * @since Twenty Ten 1.0
 * @return string The gallery style filter, with the styles themselves removed.
 */
function twentyten_remove_gallery_css( $css ) {
	return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
}
add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );

if ( ! function_exists( 'twentyten_comment' ) ) :
/**
 * Template for comments and pingbacks.
 *
 * To override this walker in a child theme without modifying the comments template
 * simply create your own twentyten_comment(), and that function will be used instead.
 *
 * Used as a callback by wp_list_comments() for displaying the comments.
 *
 * @since Twenty Ten 1.0
 */
function twentyten_comment( $comment, $args, $depth ) {
	$GLOBALS['comment'] = $comment;
	switch ( $comment->comment_type ) :
		case '' :
	?>
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
		<div id="comment-<?php comment_ID(); ?>">
		<div class="comment-author vcard">
			<?php echo get_avatar( $comment, 40 ); ?>
			<?php printf( __( '%s <span class="says">says:</span>', 'theme1095' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
		</div><!-- .comment-author .vcard -->
		<?php if ( $comment->comment_approved == '0' ) : ?>
			<em><?php _e( 'Your comment is awaiting moderation.', 'theme1095' ); ?></em>
			<br />
		<?php endif; ?>

		<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
			<?php
				/* translators: 1: date, 2: time */
				printf( __( '%1$s at %2$s', 'theme1095' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'theme1095' ), ' ' );
			?>
		</div><!-- .comment-meta .commentmetadata -->

		<div class="comment-body"><?php comment_text(); ?></div>

		<div class="reply">
			<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
		</div><!-- .reply -->
	</div><!-- #comment-##  -->

	<?php
			break;
		case 'pingback'  :
		case 'trackback' :
	?>
	<li class="post pingback">
		<p><?php _e( 'Pingback:', 'theme1095' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'theme1095'), ' ' ); ?></p>
	<?php
			break;
	endswitch;
}
endif;

// custom Post Types
add_action('init', 'custom_post_types');
function custom_post_types() {

	// Slider
		register_post_type(
			'primary2',	array(
				'label' => __('Slider', 'perfect'),
				'public' => true,
				'show_ui' => true,
				'hierarchical' => false,
				'rewrite' => true,
				'exclude_from_search' => false,
				'supports' => array(
					'title',
					'editor',
					'page-attributes',
					'thumbnail',
				),
			)
		);
		
}

/**
 * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
 *
 * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
 * function tied to the init hook.
 *
 * @since Twenty Ten 1.0
 * @uses register_sidebar
 */
function twentyten_widgets_init() {
	// Area 1, located at the top of the sidebar.
	/*register_sidebar( array(
		'name' => __( 'Primary Widget Area', 'theme1095' ),
		'id' => 'primary-widget-area',
		'description' => __( 'The primary widget area', 'theme1095' ),
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );*/

	// Area 3, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'First Footer Widget Area', 'theme1095' ),
		'id' => 'first-footer-widget-area',
		'description' => __( 'The first footer widget area', 'theme1095' ),
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 4, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'Second Footer Widget Area', 'theme1095' ),
		'id' => 'second-footer-widget-area',
		'description' => __( 'The second footer widget area', 'theme1095' ),
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 5, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'Third Footer Widget Area', 'theme1095' ),
		'id' => 'third-footer-widget-area',
		'description' => __( 'The third footer widget area', 'theme1095' ),
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 6, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'Fourth Footer Widget Area', 'theme1095' ),
		'id' => 'fourth-footer-widget-area',
		'description' => __( 'The fourth footer widget area', 'theme1095' ),
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );
	
	if ( function_exists('register_sidebar') ) {
	register_sidebar(array(
	'name' => 'Facebook Sidebar',
	'id' => 'facebook-sidebar',
	'description' => 'Appears as the sidebar on the custom homepage',
	'before_widget' => '<h2>Latest Magz</h2><div class="top-sidebar"></div><li id="%1$s" class="widget %2$s">',
	'after_widget' => '</li>',
	'before_title' => '<h2 class="widgettitle">',
	'after_title' => '</h2>',
	));
	}
}

/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'twentyten_widgets_init' );

/**
 * Removes the default styles that are packaged with the Recent Comments widget.
 *
 * To override this in a child theme, remove the filter and optionally add your own
 * function tied to the widgets_init action hook.
 *
 * @since Twenty Ten 1.0
 */
function twentyten_remove_recent_comments_style() {
	global $wp_widget_factory;
	remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );

if ( ! function_exists( 'twentyten_posted_on' ) ) :
/**
 * Prints HTML with meta information for the current post—date/time and author.
 *
 * @since Twenty Ten 1.0
 */
function twentyten_posted_on() {
	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'theme1095' ),
		'meta-prep meta-prep-author',
		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
			get_permalink(),
			esc_attr( get_the_time() ),
			get_the_date()
		),
		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
			get_author_posts_url( get_the_author_meta( 'ID' ) ),
			sprintf( esc_attr__( 'View all posts by %s', 'theme1095' ), get_the_author() ),
			get_the_author()
		)
	);
}
endif;

if ( ! function_exists( 'twentyten_posted_in' ) ) :
/**
 * Prints HTML with meta information for the current post (category, tags and permalink).
 *
 * @since Twenty Ten 1.0
 */
function twentyten_posted_in() {
	// Retrieves tag list of current post, separated by commas.
	$tag_list = get_the_tag_list( '', ', ' );
	if ( $tag_list ) {
		$posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'theme1095' );
	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
		$posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'theme1095' );
	} else {
		$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'theme1095' );
	}
	// Prints the string, replacing the placeholders.
	printf(
		$posted_in,
		get_the_category_list( ', ' ),
		$tag_list,
		get_permalink(),
		the_title_attribute( 'echo=0' )
	);
}
endif;

function add_custom_logo($header_callback = '', $admin_header_callback = '', $admin_image_div_callback = '') {
	if ( isset($GLOBALS['custom_logo']) )
		return;

	if ( empty($header_callback) )
		$header_callback = '_custom_background_cb';

	add_action('wp_head', $header_callback);

	add_theme_support( 'custom-logo' );

	if ( ! is_admin() )
		return;
	require_once(TEMPLATEPATH . '/custom-logo.php');
	$GLOBALS['custom_logo'] =& new Custom_logo($admin_header_callback, $admin_image_div_callback);
	add_action('admin_menu', array(&$GLOBALS['custom_logo'], 'init'));
}
/**
 * Update theme modification value for the current theme.
 *
 * @since 2.1.0
 *
 * @param string $name Theme modification name.
 * @param string $value theme modification value.
 */
function set_theme_mod_tm($name, $value) {
	$theme = get_current_theme();

	$mods = get_option("logo_$theme");

	$mods[$name] = $value;

	update_option("logo_$theme", $mods);
	wp_cache_delete("logo_$theme", 'options');
}
/**
 * Remove theme modification name from current theme list.
 *
 * If removing the name also removes all elements, then the entire option will
 * be removed.
 *
 * @since 2.1.0
 *
 * @param string $name Theme modification name.
 * @return null
 */
function remove_theme_mod_tm( $name ) {
	$theme = get_current_theme();

	$mods = get_option("logo_$theme");

	if ( !isset($mods[$name]) )
		return;

	unset($mods[$name]);

	if ( empty($mods) )
		return remove_theme_mods();

	update_option("logo_$theme", $mods);
	wp_cache_delete("logo_$theme", 'options');
}
/**
 * Retrieve theme modification value for the current theme.
 *
 * If the modification name does not exist, then the $default will be passed
 * through {@link http://php.net/sprintf sprintf()} PHP function with the first
 * string the template directory URI and the second string the stylesheet
 * directory URI.
 *
 * @since 2.1.0
 * @uses apply_filters() Calls 'theme_mod_$name' filter on the value.
 *
 * @param string $name Theme modification name.
 * @param bool|string $default
 * @return string
 */
function get_theme_mod_tm($name, $default = false) {
	$theme = get_current_theme();

	$mods = get_option( "logo_$theme" );

	if ( isset($mods[$name]) )
		return apply_filters( "theme_mod_$name", $mods[$name] );

	return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri()) );
}
/*
/*---------------cufon---------------*/
/*
Plugin Name: WP-Cuf&oacute;n
Plugin URI: http://www.tobias-battenberg.de/code/wp-cufon
Description: Enables Cuf&oacute;n font-replacement in WordPress - After installation you only have to put your generated font-files to <em>/wp-content/plugins/fonts/</em> directory. Go to the <a href='themes.php?page=wp-cufon.php'>Settings Page</a> for more instructions and to add your own replacement scripts.
Version: 1.6.6
Author: Tobias Battenberg
Author URI: http://www.tobias-battenberg.de
*/
?>
<?php

/*
// Backwards compatibility (WP pre 2.6) shim for URL and directory constants
if ( ! defined( 'WP_CONTENT_URL' ) )
      define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
if ( ! defined( 'WP_CONTENT_DIR' ) )
      define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
if ( ! defined( 'WP_PLUGIN_URL' ) )
      define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
if ( ! defined( 'WP_PLUGIN_DIR' ) )
      define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );


function wpcufon_jquery_init() {
    // jQuery Enabler
	if(get_option("cufon_jquery") == "1"){
    	wp_enqueue_script( 'jquery' );
    }            
}    
 
add_action('init', wpcufon_jquery_init);



function wpcufon_init() {	
?> 
    <!-- WP-Cufon Plugin 1.6.5 START  -->
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/cufon-yui.js"></script>
            
    <?php   
		// Collect names of fonts being used
		$fontStrArr = array();

		// Seach for fontFamily: 'xxx' 
		preg_match_all('/fontFamily:\s*\'([a-zA-Z0-9\s\-]+)\'/', get_option("cufon_replacement_script"), $arr);
		foreach($arr[1] as $f){
			$fontStrArr[] = str_replace(array("'"," "),array("","_"), $f);
		}

		// Search for 'fontFamily', 'xxx'
		preg_match_all('/\'fontFamily\',\s*\'([a-zA-Z0-9\s\-]+)\'/', get_option("cufon_replacement_script"), $arr);
		foreach($arr[1] as $f){
			$fontStrArr[] = str_replace(array("'"," "),array("","_"), $f);
		}
		
		// Collapse multiple uses of same font
		$fontStrArr = array_unique($fontStrArr);
		
		// If we have any font names, look for corresponding font files
		if(0 < count($fontStrArr)) {
			// create regex pattern
			$pattern = '/(' . join('|', $fontStrArr) . ')/';

			// Match against font files found
			foreach (glob(TEMPLATEPATH . "/fonts/*.js") as $filename) {    
					
				$filename = basename($filename);
				if(preg_match($pattern , $filename, $m)){  		
					?> 
					<!-- WP-Cufon Fonts found  -->
					<script src="<?php bloginfo('stylesheet_directory'); ?>/fonts/<?php echo $filename; ?>" type="text/javascript"></script>
					<?php
				} //end if font file matches fonts used
			} //end foreach
		} // end if any font used
		?>                
   
            
<?php } // end function
add_action(get_option("cufon_init_position"), 'wpcufon_init');


function wp_cufon_replacement() {
	?>
	 <!-- WP-Cufon Plugin Replacements --> 
	<script type="text/javascript">
        <?php echo stripslashes(get_option("cufon_replacement_script")); ?> 
    </script>            
	<!-- WP-Cufon END  -->	
	<?php
}
add_action(get_option("cufon_replacement_position"), 'wp_cufon_replacement');


function wp_cufon_delay() {
	?>
	<?php if(get_option("cufon_delay_fix") == "1"){ ?>
    <!-- WP-Cufon Delay Fixes enabled! (rude beta) -->
        <!--[if IE]> 
            <script type="text/javascript" defer="defer">Cufon.now()</script> 
        <![endif]--> 
        <script type="text/javascript">
            Cufon.refresh(); 
            Cufon.now();
        </script>
    <?php }
}
add_action(get_option("cufon_delay_position"), 'wp_cufon_delay');



// add js.tag for better ie6/7 compatibility before </body> ends!
// Note: This step will hopefully become obsolete in the future.
// switches off if delay fix == on.
function wp_cufon_ietag() {
	?>
    <!-- WP-Cufon Plugin (ie6/7 compatibility tag)  -->    
    <?php if(get_option("cufon_delay_fix") == "0"){ ?> <script type="text/javascript"> Cufon.now(); </script><?php } ?>    
<?php }
add_action('wp_footer', 'wp_cufon_ietag');



/*

ADMIN

*//*

add_action('admin_menu', 'wpcufon_config_page');

function wpcufon_config_page() {
	if ( function_exists('add_submenu_page') )
		//add_submenu_page('themes.php', __('WP-Cuf&oacute;n'), __('Cuf&oacute;n'), '8', 'wp-cufon.php', 'wpcufon_settings_page');
		add_theme_page( 'WP-Cuf&oacute;n', 'Cuf&oacute;n', administrator, 'wp-cufon.php', wpcufon_settings_page);
}


 
function admin_register_head() {	    
	?>
    <script language="javascript">	  
		jQuery(document).ready( function($) {		
		   $("#tutorial_button").click(function () {
			  if ($("#tutorial").is(":hidden")) {
				$("#tutorial").slideDown("slow");
				 $("#tutorial_button").text("Hide Tutorial");
			  } else {
				$("#tutorial").hide();
				$("#tutorial_button").text("Show Tutorial");
			  }
			});		
		});	  
	</script>
	<style>
		#tutorial {
		display: none;
		height: auto;
		width: 100%;
		padding:20px;
		border:1px solid #ccc;
    }
    </style>    
    <?php
}
add_action('admin_head', 'admin_register_head');

    



function wpcufon_settings_page() { 
?>	
	<!-- Messages -->
    <?php if ( !empty($_POST ) ) : ?>
	    <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
    <?php endif; ?>
    
    <?php
	if(!is_dir(TEMPLATEPATH . "/fonts")) { ?>
		<div id="message" class="updated fade"><p><strong>Please create the /fonts/ Directory in your theme</strong></p></div>
    <?php } ?>
    
    <div class="wrap">
    <div class="icon32" id="icon-themes"><br></div>
    <h2>Cuf&oacute;n Administration</h2>
    
    <div class="narrow">
    This Plugin enables <a href="http://wiki.github.com/sorccu/cufon" target="_blank">Cuf&oacute;n</a> in your WordPress Blog.<br />       
    </p>	
   
    
    <h3>--<br />Tutorial</h3>
    <a href="javascript:void(0);" id="tutorial_button">Show Tutorial</a><br /><br />
    
    <div id="tutorial">    
    <h3>How to generate & activate the fonts</h3>
    <ul style="list-style:outside; list-style-type:disc;padding-left:15px;">
      <li><small>First you have to convert your font-file (.ttf, .otf) into a Cuf&oacute;n compatible format.<br />You can do this by using Cuf&oacute;n's own generator at <a href="http://cufon.shoqolate.com/generate/" target="_blank">http://cufon.shoqolate.com/generate/</a></small></li>
      <li><small>In the next step you must create the directory /fonts/ in your theme </small></li>
      <li><small>Then upload your <em>.font.js</em> font-files to <span class="code">your_theme/fonts/</span><br />The Plugin will recognize your uploaded fonts and activate them.</small>
      </li>
      <li><small>If your font doesn't get recognized check the exact font-family FontName in your fontfile and set it right in your replacement code!<br />Check the first line in your font.js file to get the fontName (see <b>bold</b> example below).</small></li>
      <li><small>Example: (in a font.js file) <span class="code">Cufon.registerFont({"w":205,"face":{"font-family":"<b>Vegur Bold</b>", ...</span></small></li>
    </ul>
    <p>&nbsp;</p> 
    
    <h3>Set the font-replacements</h3>
    <small>
        <b>Easy Example:</b><br />
        <span class="code">
            Cufon.set('fontFamily', 'Amaze').replace('h1')('h2');
        </span>
        
        <br /><br />
        
        <b>Replace with different fonts:</b><br />
        <span class="code">
            Cufon.set('fontFamily', 'NiftyFont');<br /><br />
			
            Cufon.replace('#welcome');<br />
            Cufon.replace('#sidebar h2');<br />
            Cufon.replace('#content .title');<br /><br />
            
            Cufon.set('fontFamily', 'AnotherNiceFont');<br />
            
            Cufon.replace('h4');<br />
            Cufon.replace('.quote');<br />
            Cufon.replace('#message');
        </span>
        
        <br /><br />
        
        <b>Access via JavaScript frameworks: (e.g. jQuery needs to be enabled)</b><br />
        <span class="code">
            Cufon.replace('#your_div_id > h1:first-child', { fontFamily: 'FontName With Spaces' });<br />
            Cufon.replace('#your_div_id a', { fontFamily: 'FontName' });<br />
            Cufon.replace('#your_div_id', { fontFamily: 'FontName-Medium' });
        </span>
        
        <br /><br />
        
        <b>Other Examples:</b><br />
        <span class="code">
            Cufon.set('fontFamily', 'Vegur');<br />
            Cufon.replace('#blog-title a', { hover: true });<br />
            Cufon.replace('.menu a', { hover: true, fontWeight: '800' });<br />
            Cufon.replace('.aside h3');<br />
            Cufon.replace('h1.page-title' , { fontWeight: '400' });<br />
            Cufon.replace('h1.entry-title', { fontWeight: '400' });<br />
            Cufon.replace('h2.entry-title', { fontWeight: '400', hover: true });<br />
        </span>
        
        &raquo; <a href="http://wiki.github.com/sorccu/cufon/styling" target="_blank">Get more styling hints</a>        
        <br />  <br />      
        <span style="color:red;">&raquo; If nothing works try to rename your font.js file and your font-family string to the same name and don't use any blanks!</span>
        <br />
        &raquo; For questions about Cuf&oacute;n please visit the <a href="http://groups.google.com/group/cufon" target="_blank">Google Group!</a>
        <br /><br />
        &raquo; Please do not use copyrighted fonts!
        <br />
        &raquo; Cuf&oacute;n is distributed under the <a href="http://en.wikipedia.org/wiki/MIT_License" target="_blank">MIT license</a> by Simo Kinnunen.
    </small>
        
    </div> <!-- /tutorial -->   
       
   <h3>--<br />Your Fonts</h3>
    <?php wpcufon_get_fonts(); ?>
    <p>&nbsp;</p>
   
   
    <?php wpcufon_set_font_replacements(); ?>
    
    </div><!-- narrow -->   
    </div><!-- wrap -->

<?php
}


function wpcufon_get_fonts() {	
	?>
    <p><strong>The plugin automatically found these font-files for Cuf&oacute;n:</strong><br />
    <small>WP-Cuf&oacute;n only activates those fonts you <strong>set</strong> in your replacement-code with a right font-Family name!</small>
    </p>	
    <p>
    <ul>
    <?php
	foreach (glob(TEMPLATEPATH  . "/fonts/*.js") as $filename) {
		
		// delete path from filename (looks better)
		$short_filename = basename($filename);		
		?>
		<li>
        <img src="<?php bloginfo('stylesheet_directory'); ?>/fonts/icon_ttf.gif" /> <a href="<?php bloginfo('stylesheet_directory'); ?>'/fonts/'<?php $short_filename; ?>" target="_blank"><?php echo $short_filename; ?></a><br />
        <small><strong>Excerpt: </strong><?php $filename_content = file_get_contents ($filename); echo substr($filename_content, 0, 110); ?> ...</small>
		</li>
		<?php
	}
	
	// if empty
	if(!isset($filename)){
		echo"<em>No files found!</em>";
		?><div id="message" class="updated fade"><p><strong>No files found in fonts/</strong></p></div><?php	
	}
    
	?>
    </ul>
    </p>
    
	<?php
}



/*
	FONT REPLACEMENTS (text src)
*/
/*
$cufon_replacement_script = stripslashes(get_option('cufon_replacement_script'));
 
if ('saveDB' == $_POST['action']) {
	update_option("cufon_replacement_script",stripslashes($_POST['cufon_replacement_script']));
	update_option("cufon_jquery",$_POST['cufon_jquery']);
	update_option("cufon_delay_fix",$_POST['cufon_delay_fix']);
	update_option("cufon_init_position",$_POST['cufon_init_position']);
	update_option("cufon_replacement_position",$_POST['cufon_replacement_position']);	
	update_option("cufon_delay_position",$_POST['cufon_delay_position']);	
}

$first_script_value = "Cufon.set('fontFamily', 'Vegur').replace('h1')('h2');";
add_option("cufon_replacement_script",stripslashes($first_script_value));
add_option("cufon_jquery","");
add_option("cufon_delay_fix","");
add_option("cufon_init_position","wp_head");
add_option("cufon_replacement_position","wp_head");
add_option("cufon_delay_position","wp_footer");


function wpcufon_set_font_replacements(){
?>
   <h3>--<br />Your Cuf&oacute;n replacement-code</h3>
    
<form name="form1" method="post" action="">
	<textarea class="code" name="cufon_replacement_script" rows="12" cols="80"><?php echo stripslashes(get_option("cufon_replacement_script"));?></textarea>
    <p><em><strong>Hint:</strong> Set all the other font-details in your style.css file -  Cuf&oacute;n will recognize them.</em></p>
    
    <p>&nbsp;</p>
    <h3>--<br />Additional Features</h3>
    	
    <p><label><input name="cufon_jquery" type="checkbox" value="1" <?php if(get_option("cufon_jquery") == "1"){ echo"checked"; }?>  /> Enable jQuery <small>(WP-Cuf&oacute;n will do it only if it's necessary)</small></label></p>
    
    <p><label><input name="cufon_delay_fix" type="checkbox" value="1" <?php if(get_option("cufon_delay_fix") == "1"){ echo"checked"; }?>  /> Delay-Fix - Enables some "Hacks" to get rid of Cuf&oacute;n's delayed appearence on your site <small>(rude and beta)</small></label></p>
    
    <br /><br />
    <h3>--<br />Script Positions</h3>
    <p><small>
    	You can switch the positions from where the scripts should get loaded in your templates sourcecode.<br />
    	This can fix some errors in Firefox (e.g. FireBug Console: Error "9").
    </small>
    </p>
    <table>
    <tr>
    <td style="padding-right:40px;">
    <p>	Cufon Initial-Script:<br />    	
        <label><input name="cufon_init_position" type="radio" value="wp_head" <?php if(get_option("cufon_init_position") == "wp_head"){ echo"checked"; }?>  /><small> Header (Recommended)</small></label><br />
        <label><input name="cufon_init_position" type="radio" value="wp_footer" <?php if(get_option("cufon_init_position") == "wp_footer"){ echo"checked"; }?>  /><small> Footer</small></label>  
    </p>
    </td>
    
    <td style="padding-right:30px;">
    <p>	Cufon Replacement-Script:<br />
    	<label><input name="cufon_replacement_position" type="radio" value="wp_head" <?php if(get_option("cufon_replacement_position") == "wp_head"){ echo"checked"; }?>  /><small> Header (Recommended)</small></label><br />
    	<label><input name="cufon_replacement_position" type="radio" value="wp_footer" <?php if(get_option("cufon_replacement_position") == "wp_footer"){ echo"checked"; }?>  /><small> Footer</small></label>         
    </p>
    </td>
    
    <td>
    <p>	Cufon Delay-Fix:<br />    	
        <label><input name="cufon_delay_position" type="radio" value="wp_head" <?php if(get_option("cufon_delay_position") == "wp_head"){ echo"checked"; }?>  /><small> Header</small></label><br />  
        <label><input name="cufon_delay_position" type="radio" value="wp_footer" <?php if(get_option("cufon_delay_position") == "wp_footer"){ echo"checked"; }?>  /><small> Footer (Recommended)</small></label>
    </p>
    </td>
    </tr>
    </table>
    
    <p>&nbsp;</p>
    
    <div style="float:left; margin-right:30px;"><p><input name="action" value="saveDB" type="hidden" /> <input type="submit" value=" Save Settings " /></p></div>
    <div style="float:left"><a href='http://www.pledgie.com/campaigns/10384' target="_blank"><img alt='Click here to lend your support to: WP-Cufón and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/10384.png?skin_name=chrome' border='0' /></a></div>
    <div style="clear:both"></div>   
</form>
    <?php
}
*/


/*-------------menu -------------*/
function wp_nav_menu_tm( $args = array() ) {
	static $menu_id_slugs = array();

	$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => 'dropmenu', 'menu_class' => 'menu', 'menu_id' => '',
	'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '',
	'depth' => 0, 'walker' => '', 'theme_location' => '' );

	$args = wp_parse_args( $args, $defaults );
	$args = apply_filters( 'wp_nav_menu_args', $args );
	$args = (object) $args;

	// Get the nav menu based on the requested menu
	$menu = wp_get_nav_menu_object( $args->menu );

	// Get the nav menu based on the theme_location
	if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) )
		$menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] );

	// get the first menu that has items if we still can't find a menu
	if ( ! $menu && !$args->theme_location ) {
		$menus = wp_get_nav_menus();
		foreach ( $menus as $menu_maybe ) {
			if ( $menu_items = wp_get_nav_menu_items($menu_maybe->term_id) ) {
				$menu = $menu_maybe;
				break;
			}
		}
	}

	// If the menu exists, get its items.
	if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
		$menu_items = wp_get_nav_menu_items( $menu->term_id );

	// If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists
	if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) )
		&& ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) )
			return call_user_func( $args->fallback_cb, (array) $args );

	// If no fallback function was specified and the menu doesn't exists, bail.
	if ( !$menu || is_wp_error($menu) )
		return false;

	$nav_menu = $items = '';

	$show_container = false;
	if ( $args->container ) {
		$allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) );
		if ( in_array( $args->container, $allowed_tags ) ) {
			$show_container = true;
			$class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"';
			$id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : '';
			$nav_menu .= '<'. $args->container . $id . $class . '>';
		}
	}

	// Set up the $menu_item variables
	_wp_menu_item_classes_by_context( $menu_items );

	$sorted_menu_items = array();
	foreach ( (array) $menu_items as $key => $menu_item )
		$sorted_menu_items[$menu_item->menu_order] = $menu_item;

	unset($menu_items);

	$items .= walk_nav_menu_tree_tm( $sorted_menu_items, $args->depth, $args );
	unset($sorted_menu_items);

	// Attributes
	if ( ! empty( $args->menu_id ) ) {
		$slug = $args->menu_id;
	} else {
		$slug = 'menu-' . $menu->slug;
		while ( in_array( $slug, $menu_id_slugs ) ) {
			if ( preg_match( '#-(\d+)$#', $slug, $matches ) )
				$slug = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $slug);
			else
				$slug = $slug . '-1';
		}
	}
	$menu_id_slugs[] = $slug;
	$attributes = ' id="' . $slug . '"';
	$attributes .= $args->menu_class ? ' class="'. $args->menu_class .'"' : '';

	$nav_menu .= '<ul'. $attributes .'>';

	// Allow plugins to hook into the menu to add their own <li>'s
	$items = apply_filters( 'wp_nav_menu_items', $items, $args );
	$items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );
	$nav_menu .= $items;
	unset($items);

	$nav_menu .= '</ul>';

	if ( $show_container )
		$nav_menu .= '</' . $args->container . '>';

	$nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );

	if ( $args->echo )
		echo $nav_menu;
	else
		return $nav_menu;
}
function walk_nav_menu_tree_tm( $items, $depth, $r ) {
	require_once TEMPLATEPATH . '/nav-menu.php';
	$walker = ( empty($r->walker) ) ? new Walker_Nav_Menu_tm : $r->walker;
	$args = array( $items, $depth, $r );

	return call_user_func_array( array(&$walker, 'walk'), $args );
}


/* ------------------ social network icons widget ------------------ */

add_action('admin_menu', 'tm_socicons_form');
function tm_socicons_form() {
	if ( function_exists('add_submenu_page') )
		//add_submenu_page('themes.php', __('WP-Cuf&oacute;n'), __('Cuf&oacute;n'), '8', 'wp-cufon.php', 'wpcufon_settings_page');
		add_theme_page( 'WP-Soc-Icons', 'Social Network Links', administrator, 'soc-icons', wp_socicons_settings_page);
}

function wp_socicons_settings_page() { 

	function socicons_enable() {
    // jQuery Enabler
	if(get_option("socicons_enable") == "1"){
    	wp_enqueue_script( 'jquery' );
    }            
}    
 
add_action('init', socicons_enable);

if ('saveSI' == $_POST['action']) {
	update_option("socicons_enable",$_POST['socicons_enable']);
	update_option("link_facebook",$_POST['link_facebook']);
	update_option("link_flickr",$_POST['link_flickr']);
	update_option("link_blogger",$_POST['link_blogger']);
	update_option("link_linkedin",$_POST['link_linkedin']);
	update_option("link_myspace",$_POST['link_myspace']);
	update_option("link_twitter",$_POST['link_twitter']);
	
	update_option("link_doppler",$_POST['link_doppler']);
	update_option("link_me",$_POST['link_me']);
	update_option("link_vimeo",$_POST['link_vimeo']);
}
//$soclinks
$soclinks = array();
array_push ($soclinks, array("blogger" => get_option("link_blogger")));
array_push ($soclinks, array("facebook" => get_option("link_facebook")));
array_push ($soclinks, array("flickr" => get_option("link_flickr")));
array_push ($soclinks, array("linkedin" => get_option("link_linkedin")));
array_push ($soclinks, array("myspace" => get_option("link_myspace")));
array_push ($soclinks, array("twitter" => get_option("link_twitter")));

array_push ($soclinks, array("link_doppler" => get_option("link_doppler")));
array_push ($soclinks, array("link_me" => get_option("link_me")));
array_push ($soclinks, array("link_vimeo" => get_option("link_vimeo")));

?>  
<div class="wrap">
	<div class="icon32" id="icon-themes"><br></div>
	<h2>Social Network Settings Page</h2>
    <form name="form1" method="post" action="">
    	<p><strong>You may enable the Social Network Links in the header of your site.</strong></p>
        <p><label><input name="socicons_enable" type="checkbox" value="1" <?php if(get_option("socicons_enable") == "1"){ echo"checked"; }?>  /> Enable Social Network Links</label></p> 
        <p>
        	<strong>Networks list</strong><br />
            Insert name of your account in the needed social network
        </p> 
        <p><label><input name="link_blogger" type="text" value="<?php echo get_option("link_blogger") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_blogger.com.png" align="left" alt="" /> Blogger Account</label></p>
        <p><label><input name="link_facebook" type="text" value="<?php echo get_option("link_facebook") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_facebook.com.png" align="left" alt="" /> Facebook Account</label></p>
        <p><label><input name="link_flickr" type="text" value="<?php echo get_option("link_flickr") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_flickr.com.png" align="left" alt="" /> Flickr Account</label></p>
        <p><label><input name="link_linkedin" type="text" value="<?php echo get_option("link_linkedin") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_linkedin.com.png" align="left" alt="" /> Linkedin Account</label></p>
        <p><label><input name="link_myspace" type="text" value="<?php echo get_option("link_myspace") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_myspace.com.png" align="left" alt="" /> Myspace Account</label></p>
        <p><label><input name="link_twitter" type="text" value="<?php echo get_option("link_twitter") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_twitter.com.png" align="left" alt="" /> Twitter Account</label></p>
        <p><label><input name="link_doppler" type="text" value="<?php echo get_option("link_doppler") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_doppler.com.png" align="left" alt="" /> doppler</label></p>
        <p><label><input name="link_me" type="text" value="<?php echo get_option("link_me") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_me.com.png" align="left" alt="" /> Mobile Me</label></p>
        <p><label><input name="link_vimeo" type="text" value="<?php echo get_option("link_vimeo") ?>" /> <img width="22" height="22" src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-icons/icon_vimeo.com.png" align="left" alt="" /> Vimeo</label></p>
	    <p><input name="action" value="saveSI" type="hidden" /> <input type="submit" value=" Save " /></p>      
	</form>
</div>
<?php
}

function list_soc_links() { 
	$soclinks = array();
	if (get_option("link_blogger")) array_push ($soclinks, array("blogger.com" => get_option("link_blogger")));
	if (get_option("link_facebook")) array_push ($soclinks, array("facebook.com" => get_option("link_facebook")));
	if (get_option("link_flickr")) array_push ($soclinks, array("flickr.com" => get_option("link_flickr")));
	if (get_option("link_linkedin")) array_push ($soclinks, array("linkedin.com" => get_option("link_linkedin")));
	if (get_option("link_myspace")) array_push ($soclinks, array("myspace.com" => get_option("link_myspace")));
	if (get_option("link_twitter")) array_push ($soclinks, array("twitter.com" => get_option("link_twitter")));
	if (get_option("link_doppler")) array_push ($soclinks, array("doppler.com" => get_option("link_doppler")));
	if (get_option("link_me")) array_push ($soclinks, array("me.com" => get_option("link_me")));
	if (get_option("link_vimeo")) array_push ($soclinks, array("vimeo.com" => get_option("link_vimeo")));
	return $soclinks;
}

function get_background_image_tm() {
	$default = defined('BACKGROUND_IMAGE') ? BACKGROUND_IMAGE : '';
	
	return get_theme_mod('logo_image', $default);
}

?>
